﻿
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using RoslynProxy.Builder;
using RoslynProxy.Core.Contracts;
using RoslynProxy.SourceGenerator;
using System.Diagnostics;

var assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
var trees = CSharpProgram.GetSyntaxTrees();
var currentReferences = assemblies.Select(item => MetadataReference.CreateFromFile(item.Location));
string rabdomAssemblyName = Path.GetRandomFileName();

var compilation = CSharpCompilation.Create(rabdomAssemblyName, trees, currentReferences);

var builder = new RoslynProxyServiceTypeBuilder();
builder.TryBuildSource(compilation, out var typeInfo);

Console.WriteLine(typeInfo.Source);
